package com.guli.eduService.controller.front;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guli.commonutils.R;
import com.guli.eduService.entity.EduCourse;
import com.guli.eduService.entity.EduTeacher;
import com.guli.eduService.service.EduCourseService;
import com.guli.eduService.service.EduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "前台页面接口")
@RestController
@RequestMapping("/eduservice/indexfront")
@CrossOrigin
public class indexFrontController {
    @Autowired
    private EduCourseService courseService;
    @Autowired
    private EduTeacherService teacherService;

    @ApiOperation(value = "查询前8条热门课程，前4条名师")
    @GetMapping("index")
    public R index() {
        List<EduCourse> eduList = courseService.findCourseList();
        List<EduTeacher> teacherList = teacherService.findTeacherList();
        return R.ok().data("eduList", eduList).data("teacherList", teacherList);
    }

}